// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   workSpace_use.java

package include.ajax;

import include.nseer_db.nseer_db_backup;
import include.tree_index.Nseer;
import include.tree_index.businessComment;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class workSpace_use extends HttpServlet
{

	ServletContext application;
	HttpSession session;
	nseer_db_backup erp_db;
	Nseer n;

	public workSpace_use()
	{
		erp_db = null;
		n = new Nseer();
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			businessComment demo = new businessComment();
			demo.setPath(request);
			PrintWriter out = response.getWriter();
			String human_ID = (String)dbSession.getAttribute("human_IDD");
			nseer_db_backup db = new nseer_db_backup(dbApplication);
			nseer_db_backup db1 = new nseer_db_backup(dbApplication);
			if (db.conn((String)dbSession.getAttribute("unit_db_name")) && db1.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String view_tree_name = request.getParameter("view_tree_name");
				String module_all = request.getParameter("module_all");
				String view_tree_name1 = (new StringBuilder(String.valueOf(view_tree_name))).append("_view").toString();
				String tree_table = (new StringBuilder(String.valueOf(view_tree_name))).append("_tree").toString();
				String groupName = "erp";
				String gategory = request.getParameter("gategory");
				StringBuffer buf = new StringBuffer();
				StringBuffer buff = new StringBuffer();
				String sql = (new StringBuilder("select * from ")).append(view_tree_name1).append(" where PARENT_CATEGORY_ID='").append(gategory).append("' and human_ID='").append(human_ID).append("'").toString();
				ResultSet rs = db.executeQuery(sql);
				String chain_name = "";
				while (rs.next()) 
				{
					String sql1 = (new StringBuilder("select chain_name from ")).append(tree_table).append(" where file_id='").append(rs.getString("file_id")).append("'").toString();
					ResultSet rs1 = db1.executeQuery(sql1);
					if (rs1.next())
						chain_name = rs1.getString("chain_name");
					if (rs.getString("hreflink").equals(""))
					{
						String file_path = rs.getString("file_path");
						int path_len = file_path.split("/").length;
						buff.append((new StringBuilder("style=\"background-image:url(images/mungg.gif);\" oncontextmenu=\"etv=event;right_click('")).append(chain_name).append("','','").append(view_tree_name).append(rs.getString("id")).append("','").append(rs.getString("CATEGORY_ID")).append("','").append(view_tree_name1).append("')\"  href=\"javascript:menu_").append(path_len).append("('").append(view_tree_name).append("','").append(rs.getString("CATEGORY_ID")).append("','").append(rs.getString("file_name")).append("');\"  onmousemove=\"window.status='powered by nseer erp'\" onmouseover=\"window.status='powered by nseer erp'\">").append(demo.getLang(groupName, rs.getString("file_name"))).append("\n").toString());
					} else
					{
						buf.append((new StringBuilder("style=\"background-image:url(images/muk.gif);\" oncontextmenu=\"etv=event;right_click('")).append(chain_name).append("','").append(rs.getString("file_path")).append(rs.getString("hreflink")).append("','").append(view_tree_name).append(rs.getString("id")).append("','").append(rs.getString("CATEGORY_ID")).append("','").append(view_tree_name1).append("')\"  href=\"javascript:void(0)\"  onclick=\"open_blank('").append(rs.getString("file_path")).append(rs.getString("hreflink")).append("')\" onmouseover=\"window.status='powered by nseer erp';this.href='javascript:void(0)'; return true\">").append(demo.getLang(groupName, rs.getString("file_name"))).append("\n").toString());
					}
				}
				out.print((new StringBuilder(String.valueOf(buf.toString()))).append(buff.toString()).toString());
				db.close();
				db1.close();
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
